package com.easyidea.its.domain.service.system.impl;

import java.util.Collection;
import java.util.List;

import com.easyidea.its.domain.model.system.Role;
import com.easyidea.its.domain.repository.system.RoleRepository;
import com.easyidea.its.domain.service.base.impl.BaseServiceImpl;
import com.easyidea.its.domain.service.system.RoleService;

public class RoleServiceImpl extends BaseServiceImpl<Role> implements
		RoleService {

	private RoleRepository roleRepository;

	@Override
	public RoleRepository getBaseRepository() {
		return roleRepository;
	}
	public RoleRepository getRoleRepository() {
		return roleRepository;
	}

	public void setRoleRepository(RoleRepository roleRepository) {
		this.roleRepository = roleRepository;
	}

	/**
	 * @see com.infowarelab.elearning.domain.service.platformrole.PlatformRoleService
	 *      #getPlatformRolesByStatus(String, Integer, int, int)
	 */
	public Collection<Role> getPlatformRolesByStatus(String roleName,
			Integer status, int start, int pageSize) {
		return roleRepository.getPlatformRolesByStatus(roleName, status, start,
				pageSize);
	}

	/**
	 * @see com.infowarelab.elearning.domain.service.platformrole.PlatformRoleService
	 *      #getPlatformRoleCountByStatus(String, Integer)
	 */
	public int getPlatformRoleCountByStatus(String roleName, Integer status) {
		return roleRepository.getPlatformRoleCountByStatus(roleName, status);
	}

	public int deleteRoleRelationPermissionsByRoleId(Integer roleId) {
		return roleRepository.deleteRoleRelationPermissionsByRoleId(roleId);
	}

	public void deletePlatformRoleById(Integer id) {
		roleRepository.removeBean(id);
	}

	public List<Role> getAllRoles() {
		return roleRepository.getAllRoles();
	}
}
